package com.hc.controller;

import com.hc.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

//@RestController
@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/getOne")
    @ResponseBody
    public User getOne(){
        return new User(1,"张三",18);
    }

    @RequestMapping("/getList")
    @ResponseBody
    public List<User> getList(){
        List<User> userList=new ArrayList<>();
        userList.add(new User(1,"张三",18));
        userList.add(new User(2,"李四",18));
        userList.add(new User(3,"王五",18));
        return userList;
    }
}
